package com.Ashtar.dao;

import com.Ashtar.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {

    //    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    @Insert("insert into book_db (type,name,description) values(#{type},#{name},#{description})")
    public int save(Book book);

    @Update("update book_db set type = #{type}, name = #{name}, description = #{description} where id = #{id}")
    public int update(Book book);

    @Delete("delete from book_db where id = #{id}")
    public int delete(Integer id);

    @Select("select * from book_db where id = #{id}")
    public Book getById(Integer id);

    @Select("select * from book_db")
    public List<Book> getAll();
}
